package com.javatop.service.serviceImpl;


import com.javatop.mapper.UserMapper;
import com.javatop.pojo.entity.Article;
import com.javatop.pojo.entity.CollectLike;
import com.javatop.pojo.entity.User;
import com.javatop.service.serviceInterface.UserService;
import com.javatop.mapper.UserMapper;
import com.javatop.pojo.entity.FollowBean;
import com.javatop.pojo.entity.LikeBean;
import com.javatop.service.serviceInterface.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.javatop.pojo.entity.FollowBean;
import com.javatop.pojo.entity.LikeBean;
import java.util.Collections;
import java.util.List;
import java.math.BigInteger;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /*
    负责人：
    功能：调用userMapper的update方法
    参数：User
    返回值：void
    */
    @Override
    public void update(User user){

    }


    /*
    * 负责人：
    * 功能：调用userMapper的delete方法
    * 参数：userId
    * 返回值：void
    * */
    @Override
    public void delete(Integer userId) {

    }


    /*
    * 负责人：
    * 功能：调用userMapper的updateCollectLike方法
    * 参数：collectLike
    * 返回值：void
    * */
    @Override
    public void updateCollectLike(Integer status, CollectLike collectLike){

    }


    /*
    * 负责人：
    * 功能：调用userMapper的selectCollectArticle方法，并将结果返回
    * 参数：userId
    * 返回值：Article
    * */
    @Override
    public Article selectCollectArticle(Integer userId) {

        return new Article();//这里是为了防止报错写的，记得改成函数的返回结果
    }

    /**
     * 用户服务实现类
     */

    /**
     * 负责人：霍梓航
     * 功能： 关注功能服务实现
     */
    //打捞一个mapper

    @Override
    public void addFollow(FollowBean followBean) {
        userMapper.addFollow(followBean);
    }

    @Override
    public void removeFollow(FollowBean followBean) {
        userMapper.removeFollow(followBean);
    }

    @Override
    public boolean isFollow(FollowBean followBean) {
        return userMapper.isFollow(followBean);
    }

    /*@Override
    public List<User> getFollowers(Integer authorid) {

    }*/

    /**
     * 负责人：霍梓航
     * 功能： 点赞功能服务实现
     */
    public void addLike(LikeBean likeBean) {
        userMapper.addLike(likeBean);
    }

    @Override
    public void removeLike(LikeBean likeBean) {
        userMapper.removeLike(likeBean);
    }

    @Override
    public boolean isLike(LikeBean likeBean) {
        return userMapper.isLike(likeBean);

    }
}
